package com.hyts.reactor.handler.publish;


import com.hyts.reactor.handler.subcribe.Subscriber;
import com.hyts.reactor.handler.subcribe.Subscription;

/**
 * project-name:coffice-toolbox
 * package-name:com.hyts.reactor.simple.publish
 * author:Libo/Alex
 * create-date:2019-06-25 10:58
 * email:liboware@gmail.com
 * description:此类主要用于: publisher 实现或者行为发布者操作
 */
public interface Publisher<T> {

    /**
     * Request {@link Publisher} to start streaming data.
     * <p>
     * This is a "factory method" and can be called multiple times, each time starting a new {@link Subscription}.
     * <p>
     * Each {@link Subscription} will work for only a single {@link Subscriber}.
     * <p>
     * A {@link Subscriber} should only subscribe once to a single {@link Publisher}.
     * <p>
     * If the {@link Publisher} rejects the subscription attempt or otherwise fails it will
     * signal the error via {@link Subscriber#onError}.
     *
     * @param s the {@link Subscriber} that will consume signals from this {@link Publisher}
     */
    public void subscribe(Subscriber<? super T> s);

}
